import { defineConfig, loadEnv } from "vite";
import vue from "@vitejs/plugin-vue";
import { resolve } from "path";

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  base: "/h5/ieltsTest/",
  server: {
    //使用IP能访问
    host: "0.0.0.0",
    proxy: {
      "/api": {
        target: loadEnv("", process.cwd()).VITE_APP_URL,
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, ""),
        // rewrite: (path) => path.replace(/^\/back-end\/api/, ""),
      },
    },
  },
  resolve: {
    alias: { "@": resolve(__dirname, "src") },
  },
});
